# coding=utf-8
from PO.BasePage import Base
import time


# 在行首页下方的tab页
class DiscoverPage(Base):
    #定位器
    praise_loc = ('id',"com.guokr.mentor:id/radio_button_good_reviews")
    fresh_loc =  ('id',"com.guokr.mentor:id/radio_button_fresh_tutors")
    expert_loc = ('id',"com.guokr.mentor:id/radio_button_free_time_list")
    list_loc = ('xpath','//android.widget.ListView[@resource-id="android:id/list"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]')
    order_loc = ('xpath','//android.widget.TextView[@text="立即预约"]')
    discover_page_loc = ('id', 'com.guokr.mentor:id/image_view_discovery_bg')

    def discover_page(self):
        """发现"""
        self.find_element(self.discover_page_loc).click()

    def praise(self):
        """好评"""
        self.find_element(self.praise_loc).click()

    def fresh(self):
        """新鲜"""
        self.find_element(self.fresh_loc).click()

    # def expert(self):
    #     """行家有空"""
    #     self.find_element(self.expert_loc)

    def listFirst(self):
        """列表第一条"""
        self.find_element(self.list_loc).click()

    def order(self):
        """预约按钮"""
        return self.find_element(self.order_loc).text

